#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2021-04-22 23:10
# @Author  : zeshan
# @File    : import_contact_page.py
from page_obj.base_page import BasePage
from page_obj.contact_page import ContactPage
from page_ele.import_contact_page import ImportContactPgaeEle


class ImportContactPgae(BasePage, ImportContactPgaeEle):
    def import_contact_by_file(self, file_path):
        self.wait_ele_visibility(self._upload_file)
        self.find_element(self._upload_file).send_keys(file_path) #上传文件
        self.wait_ele_visibility(self._reupload_btn) #等待出现重现上传
        self.wait_ele_visibility(self._submit_btn) #等待导入按钮出现
        self.find_element(self._submit_btn).click() #点击导入
        self.wait_ele_visibility(self._upload_succ_btn)
        self.find_element(self._upload_succ_btn).click() #点击完成
        return ContactPage(self.driver)
